<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>tcgetattr</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_009_462">&nbsp;</a>NAME</h4><blockquote>
tcgetattr - get the parameters associated with the terminal
</blockquote><h4><a name = "tag_000_009_463">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="termios.h.html">termios.h</a>&gt;

int tcgetattr(int <i>fildes</i>, struct termios *<i>termios_p</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_009_464">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>tcgetattr()</i>
function gets the parameters associated with the terminal referred to by
<i>fildes</i>
and stores them in the
<b>termios</b>
structure referenced by
<i>termios_p</i>.
The
<i>fildes</i>
argument is an open file descriptor associated with a terminal.
<p>
The
<i>termios_p</i>
argument is a pointer to a
<b>termios</b>
structure.
<p>
The
<i>tcgetattr()</i>
operation is allowed from any process.
<p>
If the terminal device supports different input and output baud
rates, the baud rates stored in the
<b>termios</b>
structure returned by
<i>tcgetattr()</i>
reflect the actual baud rates, even if they are equal. If differing
baud rates are not supported, the rate returned as the output baud
rate is the actual baud rate.
&nbsp;If the terminal device does not support split baud rates, the
input baud rate stored in the
<b>termios</b>
structure will be 0.
</blockquote><h4><a name = "tag_000_009_465">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion, 0 is returned. Otherwise, -1 is returned and
<i>errno</i>
is set to indicate the error.
</blockquote><h4><a name = "tag_000_009_466">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>tcgetattr()</i>
function will fail if:
<dl compact>

<dt>[EBADF]<dd>
The
<i>fildes</i>
argument is not a valid file descriptor.

<dt>[ENOTTY]<dd>
The file associated with
<i>fildes</i>
is not a terminal.

</dl>
</blockquote><h4><a name = "tag_000_009_467">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_009_468">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_009_469">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
In a future issue of this document, implementations which do not support differing
baud rates will be prohibited from returning 0 as the input baud rate.
</blockquote><h4><a name = "tag_000_009_470">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="tcsetattr.html">tcsetattr()</a></i>,
<i><a href="termios.h.html">&lt;termios.h&gt;</a></i>,
the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from the POSIX.1-1988 standard.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

